package easy;

/**
 * @author admin
 * 1486. 数组异或操作
 * 解题思路：按要求求出数组，再对每个元素进行异或得到结果
 */
public class LeeCode1486 {

    public int xorOperation(int n, int start) {

        int []num = new int[n];
        int res = 0;
        for (int i = 0; i < num.length; i++) {
            num[i] = start + 2*i;
        }
        for (int i : num) {
           res = res^i;
        }
        return res;
    }

    public static void main(String[] args) {

        System.out.println(new LeeCode1486().xorOperation(1, 7));
    }
}
